package com.study.day01;

import org.apache.http.HttpHost;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.indices.GetIndexRequest;
import org.elasticsearch.client.indices.GetIndexResponse;

import java.io.IOException;

public class ESTest_Index_Delete {

    public static void main(String[] args) throws IOException {

        RestHighLevelClient esClient = new RestHighLevelClient(
                RestClient.builder(new HttpHost("localhost",2001,"http"))
        );

        DeleteIndexRequest user = new DeleteIndexRequest("user");
        AcknowledgedResponse delete = esClient.indices().delete(user, RequestOptions.DEFAULT);


        System.out.println(delete.isAcknowledged());

        try {
            esClient.close();
        } catch (IOException e) {
            e.printStackTrace();
        }


    }

}
